﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;

using Common.Enums;

using GameCommon.Base;

using Menu.Components;

using Microsoft.Xna.Framework;

namespace Menu.Screens.Countdown
{
    public class Countdown : ScreenBase
    {
        public Countdown(IScreenChanger changer, object argument)
            : base(changer, argument)
        {
        }

        public override ScreenEnum Screen
        {
            get
            {
                return ScreenEnum.Countdown;
            }
        }

        public override void LoadContent()
        {
            base.LoadContent();

            this.Components = MenuLoader.Get(this.Screen);
            ////this.SetupAnimations();
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            if (this.Animations.IsFinished())
            {
                this.RemoveScreen(this.Screen);
                this.AddScreen(ScreenEnum.LoadScreen, (ScreenEnum)Argument);
            }
        }

        private void SetupAnimations()
        {
            this.Animations.Add(new CountAnimation((Text)this.Components["T_Go"], 3000, 3000));
            this.Animations.Add(new CountAnimation((Text)this.Components["T_1"], 2000, 3000));
            this.Animations.Add(new CountAnimation((Text)this.Components["T_2"], 1000, 3000));
            this.Animations.Add(new CountAnimation((Text)this.Components["T_3"], 0, 3000));
        }
    }
}